Extensible records with scoped labels
نویسنده
چکیده
Records provide a safe and flexible way to construct data structures. We describe a natural approach to typing polymorphic and extensible records that is simple, easy to use in practice, and straightforward to implement. A novel aspect of this work is that records can contain duplicate labels, effectively introducing a form of scoping over the labels. Furthermore, it is a fully orthogonal extension to existing type systems and programming languages. In particular, we show how it can be used conveniently with standard Hindley-Milner, qualified types, and MLF.
منابع مشابه
Algebraic effects for Functional Programming
Algebraic effect handlers, are recently gaining in popularity as a purely functional approach to modeling effects. In this article, we give an end-to-end overview of practical algebraic effects in the context of a compiled implementation in the Koka language. In particular, we show how algebraic effects generalize over common constructs like exception handling, state, iterators and async-await....
متن کاملFirst-class labels for extensible rows
This paper describes a type system for extensible records and variants with first-class labels; labels are polymorphic and can be passed as arguments. This increases the expressiveness of conventional record calculi significantly, and we show how we can encode intersection types, closed-world overloading, type case, label selective calculi, and first-class messages. We formally motivate the nee...
متن کاملOOHaskell
Haskell provides type-class-bounded and parametric polymorphism as opposed to subtype polymorphism of object-oriented languages such as Java and OCaml. It is a contentious question whether Haskell 98 without extensions, or with common extensions, or with new extensions can fully support conventional object-oriented programming with encapsulation, mutable state, inheritance, overriding, statical...
متن کاملHistory of Object Calculi
Records are used to model objects. A record is a function from labels to values. With record calculi, the set of messages that can be sent to objects is bounded by the set of its labels. Furthermore, records do not faithfully model objects. Two milestones in this phase are [3] and [8]. In [3], objects are modelled as read-only, recursive, fixed size records. Types are syntactic objects. A synta...
متن کاملComputational Soundness of a Call by Name Calculus of Recursively-scoped Records
The paper presents a calculus of recursively-scoped records: a two-level calculus with a traditional call-byname λ-calculus at a lower level and unordered collections of labeled λ-calculus terms at a higher level. Terms in records may reference each other, possibly in a mutually recursive manner, by means of labels. We define two relations: a rewriting relation that models program transformatio...
متن کامل